package com.tarena.lbs.basic.web.controller;

import com.tarena.lbs.base.protocol.exception.BusinessException;
import com.tarena.lbs.base.protocol.model.Result;
import com.tarena.lbs.basic.web.service.LoginService;
import com.tarena.lbs.pojo.passport.param.AdminLoginParam;
import com.tarena.lbs.pojo.passport.param.UserLoginParam;
import com.tarena.lbs.pojo.passport.vo.LoginVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;
    //第一个接口 登录
    @PostMapping("/passport/admin/login")
    public Result<LoginVO> adminLogin(AdminLoginParam param) throws BusinessException {
        LoginVO vo= loginService.doAdminLogin(param);
        return new Result<>(vo);
    }
    @PostMapping("/passport/user/login")
    public Result<LoginVO> userLogin(UserLoginParam param) throws BusinessException {
        LoginVO vo= loginService.doUserLogin(param);
        return new Result<>(vo);
    }
}
